<?php
class PetAdoptController extends Model3_Controller
{
    public function init()
    {
        $this->view->status = MN_Pets::STATUS_ADOPTION;
    }
    
    protected function indexAction()
    {
        $petsAdapter = MN_AllPetsTable::getInstance();
        $petToSwho = false;
        if(count($this->getRequest()->getParams())>0)
        {
            $petId = $this->getRequest()->getParam('petId');
            $pet = $petsAdapter->getById($petId);
            if($pet instanceof MN_Pets)
            {
                $petToSwho = $pet;
            }
        }
        
        $this->view->pet = $petToSwho;
    }

    public function listAction()
    {
        $petsAdapter = MN_PetsTable::getInstance();
        
        $pets = $petsAdapter->getAllPets($this->view->status);
        
        $this->view->pets = $pets;
    }
}
